<?php

namespace App\Http\Controllers\user;

use App\Dao\TaskDao;
use App\Dao\TaskLogDao;
use App\Exceptions\SysExceptions;
use App\Services\Code;

class TaskController extends BaseController
{
    /**
     * @throws SysExceptions
     */
    public function add_log(): array
    {
        $params = request()->all();
        $params['user_id'] = getUserToken();
        TaskLogDao::add($params);
        return Code::message('',200);
    }

    public function tasks(){
        $params = request()->all();
        $params['show'] = 1;
        return Code::message('',200,TaskDao::all($params));
    }

    public function task_logs()
    {
        $params = request()->all();
        $params['user_id'] = getUserToken();
        return Code::message('',200,TaskLogDao::all($params));
    }
}
